Skip to content

test(typescript): expand multimodal coverage - #846

Merged
AbirAbbas merged 2 commits into
Agent-Field:mainfrom
Jonesxq:tests/multimodal-comprehensive
Aug 5, 2026
Merged

test(typescript): expand multimodal coverage#846
AbirAbbas merged 2 commits into
Agent-Field:mainfrom
Jonesxq:tests/multimodal-comprehensive

Conversation

@Jonesxq

@Jonesxq Jonesxq commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the requested comprehensive TypeScript SDK tests for multimodal helpers. The new suite exercises text construction, image and audio factories, real temporary-file round trips, mocked audio downloads and failures, format fallbacks, and MIME inference for images, audio, documents, and extensionless files.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs only
  • Tests only
  • CI / tooling
  • Breaking change

Test plan

  • cd sdk/typescript && npm test -- tests/multimodal_comprehensive.test.ts (16 passed)
  • cd sdk/typescript && npm test -- tests/multimodal.test.ts tests/multimodal_comprehensive.test.ts --coverage --coverage.reportsDirectory=coverage-407 (22 passed)
  • cd sdk/typescript && npm run lint
  • cd sdk/typescript && npm test (822/823 passed; the existing resource-sensitive memory leak test reports 31.4 MB growth against a 25 MB threshold and also fails in isolation)

Test coverage

Using the unchanged multimodal.test.ts plus the new comprehensive suite, src/ai/multimodal.ts line/statement coverage increases from 38.14% to 86.59%; branch coverage is 89.58%.

  • I ran tests for the surface(s) I changed locally.
  • New code paths are covered by tests in this PR (no bare additions).
  • No code or coverage baselines were removed or lowered.
  • The coverage gate check is green in CI before requesting review.

Checklist

  • I have read docs/CONTRIBUTING.md and docs/DEVELOPMENT.md.
  • The commit follows conventional-commits style.
  • The commit is signed (no signing configuration is available in this checkout; recent main commits are also unsigned).
  • I have linked the related issue.

Related issues / PRs

Closes #407

@Jonesxq
Jonesxq requested review from a team and AbirAbbas as code owners July 31, 2026 03:26
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Performance

SDK Memory Δ Latency Δ Tests Status
TS 358 B +2% 1.61 µs -19%

✓ No regressions detected

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage gate

Thresholds from .coverage-gate.toml: per-surface ≥ 84%, aggregate ≥ 85%, max per-surface regression ≤ 1.0 pp, max aggregate regression ≤ 0.50 pp.

Surface Current Baseline Δ
control-plane 87.10% 87.40% ↓ -0.30 pp 🟡
sdk-go 92.70% 92.00% ↑ +0.70 pp 🟢
sdk-python 93.82% 93.73% ↑ +0.09 pp 🟢
sdk-typescript 91.17% 90.42% ↑ +0.75 pp 🟢
web-ui 84.75% 84.79% ↓ -0.04 pp 🟡
aggregate 85.62% 85.75% ↓ -0.13 pp 🟡

✅ Gate passed

No surface regressed past the allowed threshold and the aggregate stayed above the floor.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

📐 Patch coverage gate

Threshold: 80% on lines this PR touches vs origin/main (from .coverage-gate.toml:thresholds.min_patch).

Surface Touched lines Patch coverage Status
control-plane 0 ➖ no changes
sdk-go 0 ➖ no changes
sdk-python 0 ➖ no changes
sdk-typescript 0 ➖ no changes
web-ui 0 ➖ no changes

✅ Patch gate passed

Every surface whose lines were touched by this PR has patch coverage at or above the threshold.

@AbirAbbas AbirAbbas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took this one over since it had gone quiet.

I mutation-tested the suite rather than just reading it: deliberately broke the multimodal source four ways (image MIME fallback, the response.ok failure path, case-insensitive generic MIME inference, and the extensionless-file branch) and confirmed which breaks the tests actually catch. Three of the four were caught with precise assertions, so this is genuine coverage rather than tests that mirror the implementation.

The one that got through was Audio.fromUrl's default format — flipping it from wav to flac left all 16 tests green, because every successful-download test passed an explicit format. I've pushed a commit adding that case, and verified it fails against the mutation and passes once reverted.

One note on the PR description: the full npm test run is clean here — 823/823 on your branch before my commit, and 807/807 on current main — so the resource-sensitive memory-leak failure you flagged didn't reproduce. Nothing to do, just so it's not left as an open question.

CI is green now; the checks weren't running earlier because the workflow runs were sitting behind the first-time-contributor approval gate on our side, not because of anything you did.

@AbirAbbas
AbirAbbas added this pull request to the merge queue Aug 5, 2026
Merged via the queue into Agent-Field:main with commit 2175312 Aug 5, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TS SDK] Expand ai/multimodal.ts test coverage

2 participants